package com.czxy.servlet;

import cn.itcast.servlet.BaseServlet;
import com.alibaba.fastjson.JSON;
import com.czxy.domain.City;
import com.czxy.domain.Province;
import com.czxy.service.CityService;
import com.czxy.service.ProvinceService;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.util.List;

@WebServlet("/provinceServlet")
public class ProvinceServlet  extends BaseServlet {

    public  void  findPid() throws IOException {

        String pid = getRequest().getParameter("pid");

        CityService service = new CityService();


        List<City> list = service.findPid(Integer.parseInt(pid));

        String s = JSON.toJSONString(list);

        getResponse().getWriter().write(s);





    }























    public  void  findP() throws IOException {

        ProvinceService service = new ProvinceService();

        List<Province> list = service.findAll();

        String s = JSON.toJSONString(list);

        getResponse().getWriter().write(s);

    }
}
